#ifndef _input_h
#define _input_h

#include <string>


/** \brief Input definitions and handling. */
namespace input
{
  enum key
  {
    KEY_NONE=0,
    KEY_LEFT, KEY_UP, KEY_RIGHT, KEY_DOWN,
    KEY_ACTION, KEY_BACK,
    KEY_START, KEY_SELECT,
    KEY_ESCAPE,
    _KEY_COUNT
  };


  void update();

  void reset();

  bool isQuitRequested();

  bool isKeyDown(key pKey); ///< \brief Check whether key is currently down.
  bool isKeyUp(key pKey); ///< \brief Check whether key is currently up.
  bool isKeyPressed(key pKey); ///< \brief Check whether key was just pressed.
  bool isKeyReleased(key pKey); ///< \brief Check whether key was just released.

  /** \brief Get cursor or pen location relative to window.
    *
    * \param pos Location of cursor or pen on screen (always positive).
    * \return true if left mouse button pressed or pen down.
    */
  bool getCursor(v2<int> &pos); // TODO: only allow mouse movement inside window

  /** \brief Get the current text buffer.
    *
    * Every time the player presses a readable key,
    * it's added to an internal buffer.
    * That way the user can type some text.
    *
    * The buffer is not cleared.
    */
  std::string getTextBuffer();

  void clearTextBuffer();
}

#endif // #ifndef _input_h

